<template>
  <div>
    <ul>
      <!-- 没有设置key, 就地更新 -->
      <li
        v-for="item in arr"
        :key="item.id"
      >
        {{ item.name }}
        <input type="text">
      </li>
    </ul>
    <button @click="addBtn">点击添加一个新来的</button>
  </div>
</template>

<script>
export default {
  data() {
    return {
      arr: [
        {
          id: 1,
          name: "老大",
        },
        {
          id: 2,
          name: "老二",
        },
        {
          id: 3,
          name: "老三",
        },
      ],
    };
  },
  methods: {
    addBtn() {
      //  .splice(下标, 删除个数, 添加的数据)
      this.arr.splice(1, 0, { id: 100, name: "新来的" });
    },
  },
};
</script>

<style>
</style>